'use client'
import React from 'react'
import {Button} from 'antd';
import {usePathname, useRouter} from 'next/navigation';
import {ArrowLeftOutlined} from '@ant-design/icons'

export default function Header() {
    const router = useRouter();
    const pathname = usePathname();

    if (pathname != '/') {
        return (
            <header className="Header flex justify-between items-center mx-auto w-[95%]">
                <Button
                    type="primary"
                    icon={<ArrowLeftOutlined/>}
                    onClick={() => router.push("/")}
                >
                    Back
                </Button>
                <h1 className="text-3xl font-bold">
                    Tour booking service
                </h1>
            </header>
        );
    } else {
        return (
            <header className="Header flex justify-center items-center mx-auto">
                <h1 className="text-3xl font-bold">
                    Tour booking service
                </h1>
            </header>
        );
    }
}
